import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '../views/Login.vue'
import Index from '../views/Index.vue'
import Index2 from '../views/Index2.vue'

import WorkerManage from '../views/WorkerManage.vue'
import AddWorker from '../views/AddWorker.vue'
import UpdateWorker from '../views/UpdateWorker.vue'

import SupplierManage from '../views/SupplierManage.vue'
import AddSupplier from '../views/AddSupplier.vue'
import UpdateSupplier from '../views/UpdateSupplier.vue'

import GoodsManage from '../views/GoodsManage.vue'
import AddGoods from '../views/AddGoods.vue'
import UpdateGoods from '../views/UpdateGoods.vue'

import PurchaseManage from '../views/PurchaseManage.vue'
import AddPurchase from '../views/AddPurchase.vue'
import UpdatePurchase from '../views/UpdatePurchase.vue'

import DetailManage from '../views/DetailManage.vue'
import AddDetail from '../views/AddDetail.vue'
import UpdateDetail from '../views/UpdateDetail.vue'

import WorkerManage2 from '../views/WorkerManage2.vue'
import PurchaseManage2 from '../views/PurchaseManage2.vue'
import GoodsManage2 from '../views/GoodsManage2.vue'
import DetailManage2 from '../views/DetailManage2.vue'

Vue.use(VueRouter)

const routes = [
  {
	path: '/',
	name: '登录',
    component: Login,
	show:false
  },
  {
  	path: '/Login',
  	name: '登录',
  	component: Login,
  	show:false,
  },
  {
    path: '/Manage',
    name: '员工管理',
    component: Index,
	show:true,
	//redirect:'/WorkerManage', //输入localhost:8080时自动定向到/WorkerManage页面
	children:[
		{
			path: '/WorkerManage',
			name: '员工列表',
			component: WorkerManage,
			show:true
		},
		{
			path: '/AddWorker',
			name: '添加员工',
			component: AddWorker,
			show:true 
		},
		{
			path: '/UpdateWorker',
			name: '编辑员工',
			component: UpdateWorker,
			show:false  //在index.vue里面判断，如果show:false;则不显示在菜单栏里面
		}
	]
  },
  {
    path: '/Manage',
    name: '供应商管理',
    component: Index,
  	show:true,
  	children:[
  		{
  			path: '/SupplierManage',
  			name: '供应商列表',
  			component: SupplierManage,
  			show:true
  		},
  		{
  			path: '/AddSupplier',
  			name: '添加供应商',
  			component: AddSupplier,
  			show:true 
  		},
  		{
  			path: '/UpdateSupplier',
  			name: '编辑供应商',
  			component: UpdateSupplier,
  			show:false  //在index.vue里面判断，如果show:false;则不显示在菜单栏里面
  		}
  	]
  },
  {
    path: '/Manage',
    name: '商品管理',
    component: Index,
  	show:true,
  	children:[
  		{
  			path: '/GoodsManage',
  			name: '商品列表',
  			component: GoodsManage,
  			show:true
  		},
  		{
  			path: '/AddGoods',
  			name: '添加商品',
  			component: AddGoods,
  			show:true 
  		},
  		{
  			path: '/UpdateGoods',
  			name: '编辑商品',
  			component: UpdateGoods,
  			show:false  //在index.vue里面判断，如果show:false;则不显示在菜单栏里面
  		}
  	]
  },
  {
    path: '/Manage',
    name: '采购管理',
    component: Index,
  	show:true,
  	children:[
  		{
  			path: '/PurchaseManage',
  			name: '采购主表',
  			component: PurchaseManage,
  			show:true
  		},
  		{
  			path: '/AddPurchase',
  			name: '添加主表数据',
  			component: AddPurchase,
  			show:true 
  		},
  		{
  			path: '/UpdatePurchase',
  			name: '编辑主表数据',
  			component: UpdatePurchase,
  			show:false  //在index.vue里面判断，如果show:false;则不显示在菜单栏里面
  		},
		{
			path: '/DetailManage',
			name: '采购明细表',
			component: DetailManage,
			show:true
		},
		{
			path: '/AddDetail',
			name: '添加明细表数据',
			component: AddDetail,
			show:true 
		},
		{
			path: '/UpdateDetail',
			name: '编辑明细表数据',
			component: UpdateDetail,
			show:false  //在index.vue里面判断，如果show:false;则不显示在菜单栏里面
		}
  	]
  },
  {
  	path: '/Manage2',
  	name: '',
  	component: Index2,
  	show:false,
	children:[
		{
			path: '/WorkerManage2',
			name: '个人信息',
			component: WorkerManage2,
		},
		{
			path: '/GoodsManage2',
			name: '商品信息',
			component: GoodsManage2, 
		},
		{
			path: '/PurchaseManage2',
			name: '采购主表',
			component: PurchaseManage2,
		},
		{
			path: '/DetailManage2',
			name: '采购明细表',
			component: DetailManage2,
		}

	]
  }
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
